package cn.com.cifi.mars.web.action.operateplan;

import cn.com.cifi.mars.bean.bo.ProjectProductBO;
import cn.com.cifi.mars.bean.vo.signPlan.*;
import cn.com.cifi.mars.bean.vo.signPlan.req.ProductSignPlanParam;
import cn.com.cifi.mars.bean.vo.signPlan.req.SignPlanDetailParam;
import cn.com.cifi.mars.bean.vo.signPlan.req.SignPlanOaParam;

import org.springframework.web.bind.annotation.*;

import cn.com.cifi.mars.common.bean.R;
import cn.com.cifi.mars.common.constants.VersionConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@Api(tags = {"签约计划API"})
@RequestMapping("/${spring.data.rest.base-path}/{apiVersion}/signPlan/signPlanVersion")
public interface ISignPlanController {

	@ApiOperation(value = "创建签约计划版本", notes = "基于供货版本生成签约计划版本（审批通过的供货版本）")
	@PostMapping(value = "")
	R createSignPlanVersion(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "分期ID", required = true) @RequestParam(value = "projectFid") String projectFid,
			@ApiParam(value = "版本类型(investment-投资版 、strategy-战规版 、budget-预算版 、dynamic-动态版)", required = true)@RequestParam(name = "versionType") String versionType,
			@ApiParam(value = "预算版标签",required = false)@RequestParam(value = "versionIdentify",required = false) String versionIdentify);

	@ApiOperation(value = "删除签约计划版本", notes = "删除签约计划版本")
	@DeleteMapping(value = "")
	R deleteSignPlanVersion(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "签约计划版本Id", required = true) @RequestParam(value = "versionId") String versionId);

	@ApiOperation(value = "查询签约计划版本展示", notes = "查询签约计划版本展示")
	@GetMapping(value = "")
	R<SignPlanVersionVo> getSignPlanVersion(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "签约计划版本Id", required = true) @RequestParam(value = "versionId") String versionId,
            @ApiParam(value = "查询年份", required = false) @RequestParam(value = "year",defaultValue = "") String year);


	@ApiOperation(value = "查询产品构成的签约计划", notes = "查询产品构成的签约计划")
	@PostMapping(value = "productSignPlan")
	R getProductSignPlan(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "签约计划详情产品构成类别", required = true) @RequestBody ProductSignPlanParam productSignPlanParam);

	@ApiOperation(value = "查询签约版本全路径名称与来源版本全路径名称", notes = "查询签约版本全路径名称与来源版本全路径名称")
	@GetMapping(value = "signFullPath")
	R<FullPathVo> getSignFullPath(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "签约计划版本Id", required = true) @RequestParam(value = "versionId") String versionId);

	@ApiOperation(value = "查询签约版本全路径名称与来源版本全路径名称列表", notes = "查询签约版本全路径名称与来源版本全路径名称列表")
	@GetMapping(value = "signFullPathList")
	R<List<FullPathVo>> getSignFullPathList(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "分期ID", required = true) @RequestParam(value = "projectFid") String projectFid,
			@ApiParam(value = "版本类型(investment-投资版 、strategy-战规版 、budget-预算版 、dynamic-动态版)", required = true, defaultValue = "")
			@RequestParam(name = "versionType") String versionType);

	@ApiOperation(value = "保存产品构成的签约计划", notes = "保存产品构成的签约计划")
	@PutMapping(value = "")
	R saveProductSignPlan(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "产品构成签约计划详情", required = true) @RequestBody SignPlanDetailParam signPlanDetailParam);

	@ApiOperation(value = "查询分期最新版本类型", notes = "查询分期最新版本类型")
	@GetMapping(value = "newVersionType")
	R getNewVersionType(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "分期ID", required = true) @RequestParam(value = "projectFid") String projectFid);

	@ApiOperation(value = "查询签约计划审批预览PC", notes = "查询签约计划审批预览PC")
	@GetMapping(value = "approvalPreview")
	R<SigPlanPreviewVo> getApprovalPreview(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "项目Id", required = false) @RequestParam(value = "projectId",defaultValue = "") String projectId,
			@ApiParam(value = "审批单Id", required = false) @RequestParam(value = "billId",defaultValue = "") String billId
			);

	@ApiOperation(value = "查询全盘签约", notes = "查询全盘签约")
	@GetMapping(value = "overallSignPlanVersion")
	R<SignPlanVersionVo> getOverallSignPlanVersion(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "项目Id", required = true) @RequestParam(value = "projectId") String projectId,
			@ApiParam(value = "年份",required = false) @RequestParam(value = "year",required = false) String year,
			@ApiParam(value = "层级Code" ,required = false) @RequestParam(value = "code",required = false) String code);

	@ApiOperation(value = "查询签约计划审批预览App", notes = "查询签约计划审批预览App")
	@GetMapping(value = "approvalPreviewApp")
	R<SigPlanPreviewVo> getApprovalPreviewApp(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "项目Id", required = false) @RequestParam(value = "projectId",defaultValue = "") String projectId,
			@ApiParam(value = "审批单Id", required = false) @RequestParam(value = "billId",defaultValue = "") String billId);
	
	@ApiOperation(value = "提交到OA审批", notes = "签约审批-提交到OA审批")
    @PostMapping(value = "submitToOA")
    R<String> submitToOA(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "提交审批参数", required = false)@RequestBody SignPlanOaParam signPlanOaParam);
	
	@ApiOperation(value = "审批校验", notes = "签约审批-审批校验")
	@GetMapping(value = "approvedCheck")
	R<Map<String, Boolean>> approvedCheck(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "项目id" ,required = true) @RequestParam(name = "projectId") String projectId
			);

	@ApiOperation(value = "导出全盘签约计划报表", notes = "导出全盘签约计划报表")
	@GetMapping(value = "overallSignPlanExport")
	void overallSignPlanExport(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			HttpServletResponse response,
			@ApiParam(value = "项目Id", required = true) @RequestParam(value = "projectId") String projectId);

	@ApiOperation(value = "导出签约计划版本报表", notes = "导出全盘签约计划报表")
	@GetMapping(value = "signPlanVersionExport")
	void signPlanVersionExport(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			HttpServletResponse response,
			@ApiParam(value = "版本id", required = true) @RequestParam(value = "versionId") String versionId);

	@ApiOperation(value = "查询产品构成列表", notes = "查询产品构成列表")
	@GetMapping(value = "productList")
	R<List<SignProductVo>> getProductList(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "版本id", required = true) @RequestParam String versionId);

	@ApiOperation(value = "查询全盘签约概览", notes = "查询全盘签约概览")
	@GetMapping(value = "projectProductList")
	R<List<ProjectProductBO>> getProjectProductList(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "版本id", required = true) @RequestParam String versionId,
			@ApiParam(value = "年份", required = true) @RequestParam String year,
			@ApiParam(value = "月份", required = true) @RequestParam String month);

	@ApiOperation(value = "设置考核版", notes = "设置考核版")
	@GetMapping(value = "assessmentVersion")
	R settingsAssessmentVersion(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "版本id", required = true) @RequestParam String versionId);

	@ApiOperation(value = "异常创建签约计划版本", notes = "异常创建签约计划版本")
	@PostMapping(value = "exceptionCreateSignPlanVersion")
	R exceptionCreateSignPlanVersion(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "分期ID", required = true) @RequestParam(value = "projectFid") String projectFid,
			@ApiParam(value = "版本类型(investment-投资版 、strategy-战规版 、dynamic-动态版)", required = true)@RequestParam(name = "versionType") String versionType,
			@ApiParam(value = "预算版标签",required = false)@RequestParam(value = "versionIdentify",required = false) String versionIdentify);

	@ApiOperation(value = "查询门户代办", notes = "查询门户代办")
	@GetMapping(value = "portalTodo")
	R getPortalTodo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "分期id+版本类型code", required = true) @RequestParam String id);

	@ApiOperation(value = "手动复制一版为预算版本", notes = "设置为预算版本")
  	@GetMapping(value = "copyBudgetVersion")
  	R copyBudgetVersion(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "版本id", required = true) @RequestParam(value = "versionId", required = true) String versionId);

	@ApiOperation(value = "手动复制版本", notes = "手动复制版本")
  	@GetMapping(value = "copySignPlanVersion")
  	R copySignPlanVersion(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "版本id", required = true) @RequestParam(value = "versionId", required = true) String versionId);

	///////////////////////////////////////////////******后台手动接口******///////////////////////////////////////////////////////////

	@ApiOperation(value = "手动刷新实际签约数据", notes = "手动刷新实际签约数据\n"+
			"v1 : 刷新版本\n" +
			"v2 : 指定年月刷新")
	@GetMapping(value = "refreshSignData")
	R refreshSignData(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "版本id", required = true) @RequestParam String versionId,
			@ApiParam(value = "年月", required = true) @RequestParam String yearMonth);

	@ApiOperation(value = "手动发送签约代办",notes = "手动发送代办")
	@GetMapping(value = "refreshSignNoticeDispose")
	R signNoticeDispose(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "供货版本id", required = true) @RequestParam String supplyId);

	@ApiOperation(value = "手动消除签约代办",notes = "手动消除代办\n"+
			"1:发起流程\n"+
			"2:流程更新\n"+
			"3:删除待办\n"+
			"4:待办转已办\n"+
			"5:抄送新增\n"+
			"6:抄送处理"
	)
	@GetMapping(value = "refreshDeleteTodoInfo")
	R deleteTodoInfo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "分期id+版本类型(investment:投资版;strategy:战规版", required = true) @RequestParam String id,
			@ApiParam(value = "处理方式(1;2;3;4;5;6)", required = true) @RequestParam String operatorType);

	@ApiOperation(value = "签约计划版本修改状态(测试使用)", notes = "签约计划版本修改状态（测试使用）")
	@PutMapping(value = "updateState")
	R updateState(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "版本Ids", required = true) @RequestParam(name = "versionIds") List<String> versionIds,
			@ApiParam(value = "版本状态", required = true) @RequestParam(name = "versionState") String versionState);

}
